<?php
declare (strict_types = 1);

namespace app\shop\controller;

use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use app\common\service\FinancialService\BusinessStatisticsService;
use app\BaseShopController;
use think\Request;

/**
 * @Group("BusinessFinancial")
 * @Middleware({shopMiddileware::class})
 */
class BusinessFinancial extends BaseShopController
{
    /**
     * 获取渠道列表分页
     * @Route("getListByPage",method="GET")
     * @return string
     */
    public function getListByPage() {
        if(isset($this->_data['cb_id'])&& is_array($this->_data['cb_id'])&&$this->_master_user['cb_id']==0&&$this->_data['cb_id'][0]){
            $this->_all_data['cb_id']=$this->_data['cb_id'];
        }elseif($this->_master_user['cb_id']>0){
            $this->_all_data['cb_id']=[$this->_master_user['cb_id']];
        }else{
            unset($this->_all_data['cb_id']);
        }     
        $result = callApi(BusinessStatisticsService::class, 'BusinessList',$this->_all_data);
        return apiResponse($result);
    }
    /**
     * 获取渠道资金流水分页
     * @Route("getOrderListByPage/:cb_id",method="GET")
     * @return string
     */
    public function getOrderListByPage($cb_id) {
        $result = callApi(BusinessStatisticsService::class, 'orderList',$this->_data);
        return apiResponse($result);
    }
    
    
}
